﻿using System.Configuration;

namespace SPDeployer.Core.Config
{
    public struct Definitions
    {
        public const string WEB_APPLICATION_NAME = "WebApplication";

        public const string CONTENT_TYPES_COLLECTION = "ContentTypes";
        public const string FEATURES_COLLECTION = "Features";
        public const string LISTS_COLLECTION = "Lists";
        public const string SITES_COLLECTION = "Sites";
        public const string WEB_APPLICATIONS_COLLECTION = "WebApplications";
        public const string WEBS_COLLECTION = "Webs";

        public struct ContentTypes
        {
            public const string ID = "id";
        }
        public struct Features
        {
            public const string ACTIVATE = "activate";
            public const string ID = "id";
            public const string NAME = "name";
        }
        public struct Lists
        {
            public const string NAME = "name";
            public const string TYPE = "type";
        }
        public struct Sites
        {
            public const string DESCRIPTION = "description";
            public const string LCID = "lcid";
            public const string NAME = "name";
            public const string OWNER_EMAIL = "owneremail";
            public const string OWNER_LOGIN = "ownerlogin";
            public const string OWNER_NAME = "ownername";
            public const string URL = "url";
            public const string WEB_TEMPLATE = "webtemplate";
        }
        public struct WebApplications
        {
            public const string NAME = "name";
            public const string URL = "url";
        }
        public struct Webs
        {
            public const string NAME = "name";
            public const string URL = "url";
        }
    }

    public class StructureConfigurationSection : ConfigurationSection
    {
        [ConfigurationProperty(Definitions.WEB_APPLICATION_NAME, IsRequired = false)]
        public WebApplicationConfigurationElement WebApplication
        {
            get { return (WebApplicationConfigurationElement)this[Definitions.WEB_APPLICATION_NAME]; }
            set { this[Definitions.WEB_APPLICATION_NAME] = value; }
        }
    }
}